package com.example.vsprojekt;

/**
 * Class to cut strings
 * @author Evgenij Pfafenrot
 *
 */
public class BeschneideString { 
	/**
	 * method to cut the front of the string
	 * @param txt
	 * @param teil
	 * @param number
	 * @return string after being cut
	 */
    public String cutFront(String txt, String teil, int number) { 
        for (int i = 0; i < number; i++) { 
            txt = txt.substring(txt.indexOf(teil) + 1, txt.length()); 
        } 
        return txt; 
    } 

    /**
     * method to cut the back of the string
     * @param txt
     * @param teil
     * @param number
     * @return string after being cut
     */
    public String cutBack(String txt, String teil, int number) { 
        for (int i = 0; i < number; i++) { 
            txt = txt.substring(0, txt.lastIndexOf(teil)); 
        } 
        return txt; 
    } 
} 